package sample;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;

/**
 * Dump Servlet Request.
 */
public class HelloWorld extends HttpServlet {
    private static Logger log = Logger.getLogger(HelloWorld.class);
    static {
        BasicConfigurator.configure();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        log.info("doGet!");

        HelloWorldHelper helper = new HelloWorldHelper();
        helper.foo();

        response.setContentType("text/html");
        ServletOutputStream out = response.getOutputStream();
        out.println("<html>");
        out.println("<h1>Hello World</h1>");
        out.println("</html>");
        out.flush();
    }
}
